<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">

<title>class AboutYou::SDK::Model::FacetGroupSet - RDoc Documentation</title>

<link href="../../../fonts.css" rel="stylesheet">
<link href="../../../rdoc.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../../";
</script>

<script src="../../../js/jquery.js"></script>
<script src="../../../js/navigation.js"></script>
<script src="../../../js/search_index.js"></script>
<script src="../../../js/search.js"></script>
<script src="../../../js/searcher.js"></script>
<script src="../../../js/darkfish.js"></script>


<body id="top" role="document" class="class">
<nav role="navigation">
  <div id="project-navigation">
    <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2>
    <a href="../../../index.html" rel="home">Home</a>
  </h2>

  <div id="table-of-contents-navigation">
    <a href="../../../table_of_contents.html#pages">Pages</a>
    <a href="../../../table_of_contents.html#classes">Classes</a>
    <a href="../../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

    <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

  </div>

  

  <div id="class-metadata">
    
    <div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  
  <p class="link">Object
  
</div>

    
    
    <!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    
    <li ><a href="#method-c-merge_facet_ids">::merge_facet_ids</a>
    
    <li ><a href="#method-c-new">::new</a>
    
    <li ><a href="#method-i-contains">#contains</a>
    
    <li ><a href="#method-i-contains_facet_get_group_interface">#contains_facet_get_group_interface</a>
    
    <li ><a href="#method-i-contains_facet_group_set">#contains_facet_group_set</a>
    
    <li ><a href="#method-i-empty-3F">#empty?</a>
    
    <li ><a href="#method-i-facet">#facet</a>
    
    <li ><a href="#method-i-facet_by_key">#facet_by_key</a>
    
    <li ><a href="#method-i-fetch">#fetch</a>
    
    <li ><a href="#method-i-gen_lazy_groups">#gen_lazy_groups</a>
    
    <li ><a href="#method-i-group">#group</a>
    
    <li ><a href="#method-i-group-3F">#group?</a>
    
    <li ><a href="#method-i-group_ids">#group_ids</a>
    
    <li ><a href="#method-i-lazy_groups">#lazy_groups</a>
    
    <li ><a href="#method-i-unique_key">#unique_key</a>
    
  </ul>
</div>

  </div>
</nav>

<main role="main" aria-labelledby="class-AboutYou::SDK::Model::FacetGroupSet">
  <h1 id="class-AboutYou::SDK::Model::FacetGroupSet" class="class">
    class AboutYou::SDK::Model::FacetGroupSet
  </h1>

  <section class="description">
    
<p>This class represents a facet group set model</p>

  </section>

  
  
  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    
    <section class="attribute-method-details" class="method-section">
      <header>
        <h3>Attributes</h3>
      </header>

      
      <div id="attribute-c-facet_manager" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">facet_manager</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>instance of AboutYou::SDK::Model::Facet_Manager::DefaultFacetManager</p>
        
        </div>
      </div>
      
      <div id="attribute-i-facets" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">facets</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>Array of instances of <a href="Facet.html">AboutYou::SDK::Model::Facet</a></p>
        
        </div>
      </div>
      
      <div id="attribute-i-groups" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">groups</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>Array of instances of AboutYou::SDK::Model::FacetGroups</p>
        
        </div>
      </div>
      
      <div id="attribute-i-ids" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">ids</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>Array of ids of the facet groups in this set</p>
        
        </div>
      </div>
      
    </section>
    

    
     <section id="public-class-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Class Methods</h3>
       </header>

    
      <div id="method-c-merge_facet_ids" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">merge_facet_ids</span><span
            class="method-args">(facet_ids_array)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method merges facet ids in an multi dimensional Array</p>
<ul><li>
<p><strong>Args</strong> :</p>
<ul><li>
<p><code>facet_ids_array</code> -&gt; Multi-Dimensional-Array containing facet
ids</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Array of facet ids</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="merge_facet_ids-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 263</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">merge_facet_ids</span>(<span class="ruby-identifier">facet_ids_array</span>)
  <span class="ruby-identifier">ids</span> = {}

  <span class="ruby-identifier">facet_ids_array</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">facet_ids_hash</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">facet_ids_hash</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">group_id</span>, <span class="ruby-identifier">facet_ids</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">ids</span>[<span class="ruby-constant">Integer</span>(<span class="ruby-identifier">group_id</span>)]
        <span class="ruby-identifier">ids</span>[<span class="ruby-constant">Integer</span>(<span class="ruby-identifier">group_id</span>)] = <span class="ruby-identifier">ids</span>[<span class="ruby-constant">Integer</span>(<span class="ruby-identifier">group_id</span>)] <span class="ruby-operator">+</span>
          <span class="ruby-identifier">facet_ids</span>.<span class="ruby-identifier">uniq</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">ids</span>[<span class="ruby-constant">Integer</span>(<span class="ruby-identifier">group_id</span>)] = <span class="ruby-identifier">facet_ids</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">ids</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-c-new" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">new</span><span
            class="method-args">(ids)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Constructor for the <a
href="FacetGroupSet.html">AboutYou::SDK::Model::FacetGroupSet</a> class</p>
<ul><li>
<p><strong>Args</strong> :</p>
<ul><li>
<p><code>ids</code> -&gt; the ids of the facet groups of this set</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="FacetGroupSet.html">AboutYou::SDK::Model::FacetGroupSet</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 28</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">ids</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">facets</span> = {}
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">groups</span> = {}
  <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">_key</span>, <span class="ruby-identifier">facet_ids</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">fail</span> <span class="ruby-string">'\InvalidArgumentException! ids must be an associative array
      of [$groupId =&gt; [$facetId,...],..]'</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">facet_ids</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">ids</span> = <span class="ruby-identifier">ids</span>

  <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Instance Methods</h3>
       </header>

    
      <div id="method-i-contains" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">contains</span><span
            class="method-args">(facet_compable)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method checks whether this set contains a facet or facet group set</p>
<ul><li>
<p><strong>Args</strong> :</p>
<ul><li>
<p><code>facet_compable</code> -&gt; <a href="Facet.html">Facet</a> compable</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Either nil if wrong input or Boolean determining whether the compable is
found or not</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="contains-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 204</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">contains</span>(<span class="ruby-identifier">facet_compable</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">contains_facet_group_set</span>(<span class="ruby-identifier">facet_compable</span>) <span class="ruby-keyword">if</span>
  <span class="ruby-identifier">facet_compable</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>)

  <span class="ruby-keyword">return</span> <span class="ruby-identifier">contains_facet_get_group_interface</span>(<span class="ruby-identifier">facet_compable</span>) <span class="ruby-keyword">if</span>
  <span class="ruby-identifier">facet_compable</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">FacetGetGroupInterface</span>

  <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-contains_facet_get_group_interface" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">contains_facet_get_group_interface</span><span
            class="method-args">(facet)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method checks whether a facet is in this set or not</p>
<ul><li>
<p><strong>Args</strong> :</p>
<ul><li>
<p><code>facet</code> -&gt; <a href="Facet.html">Facet</a> compable</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Boolean determining whether this set includes the facet or not</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="contains_facet_get_group_interface-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 223</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">contains_facet_get_group_interface</span>(<span class="ruby-identifier">facet</span>)
  <span class="ruby-identifier">lazy_groups</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">lazy_groups</span>
  <span class="ruby-identifier">id</span> = <span class="ruby-identifier">facet</span>.<span class="ruby-identifier">group_id</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">lazy_groups</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">id</span>)
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">lazy_groups</span>[<span class="ruby-identifier">id</span>].<span class="ruby-identifier">unique_key</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">facet</span>.<span class="ruby-identifier">unique_key</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-contains_facet_group_set" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">contains_facet_group_set</span><span
            class="method-args">(facet_group_set)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method checks whether a facet group set is in this set or not</p>
<ul><li>
<p><strong>Args</strong> :</p>
<ul><li>
<p><code>facet_group_set</code> -&gt; <a href="Facet.html">Facet</a> compable</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Boolean determining whether this set includes the facet group set or not</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="contains_facet_group_set-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 243</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">contains_facet_group_set</span>(<span class="ruby-identifier">facet_group_set</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">unique_key</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">facet_group_set</span>.<span class="ruby-identifier">unique_key</span>

  <span class="ruby-identifier">lazy_groups</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">id</span>, <span class="ruby-identifier">group</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">if</span>
    <span class="ruby-identifier">lazy_groups</span>[<span class="ruby-string">'id'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">lazy_groups</span>[<span class="ruby-identifier">id</span>].<span class="ruby-identifier">unique_key</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">group</span>.<span class="ruby-identifier">unique_key</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-empty-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">empty?</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method checks whether this set is empty</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Boolean determining whether this set is empty or not</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="empty-3F-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 46</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-facet" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">facet</span><span
            class="method-args">(facet_group_id, facet_id)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method gets a facet by given facet if and facet group id</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p><code>facet_group_id</code> -&gt; the facet group id used for searching</p>
</li><li>
<p><code>facet_id</code> -&gt; the facet id used for searching</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Either nil if not found or instance of <a
href="Facet.html">AboutYou::SDK::Model::Facet</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="facet-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 175</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">facet</span>(<span class="ruby-identifier">facet_group_id</span>, <span class="ruby-identifier">facet_id</span>)
  <span class="ruby-identifier">fetch</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">facets</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-keyword">return</span> <span class="ruby-identifier">facets</span>[<span class="ruby-constant">String</span>(<span class="ruby-identifier">facet_group_id</span>) <span class="ruby-operator">+</span> <span class="ruby-string">':'</span> <span class="ruby-operator">+</span> <span class="ruby-constant">String</span>(<span class="ruby-identifier">facet_id</span>)] <span class="ruby-keyword">if</span>
  <span class="ruby-identifier">facets</span>[<span class="ruby-constant">String</span>(<span class="ruby-identifier">facet_group_id</span>) <span class="ruby-operator">+</span> <span class="ruby-string">':'</span> <span class="ruby-operator">+</span> <span class="ruby-constant">String</span>(<span class="ruby-identifier">facet_id</span>)]
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-facet_by_key" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">facet_by_key</span><span
            class="method-args">(key)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method gets a facet by key</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p><code>key</code> -&gt; the facet key used for searching</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Either nil if not found or instance of <a
href="Facet.html">AboutYou::SDK::Model::Facet</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="facet_by_key-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 160</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">facet_by_key</span>(<span class="ruby-identifier">key</span>)
  <span class="ruby-identifier">fetch</span>
  <span class="ruby-identifier">facets</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">facets</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-fetch" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">fetch</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method fetches the facets of this set</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Hash containing pairs of group_id =&gt; instance of <a
href="FacetGroup.html">AboutYou::SDK::Model::FacetGroup</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="fetch-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 93</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">fetch</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">facets</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">facets</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">group_id</span>, <span class="ruby-identifier">facet_ids</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">facet</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">facet_manager</span>.<span class="ruby-identifier">facet</span>(<span class="ruby-identifier">group_id</span>, <span class="ruby-identifier">facet_ids</span>[<span class="ruby-value">0</span>])
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">facet</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@groups</span>[<span class="ruby-identifier">group_id</span>]
      <span class="ruby-identifier">group</span> = <span class="ruby-ivar">@groups</span>[<span class="ruby-identifier">group_id</span>]
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">group</span> = <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">FacetGroup</span>.<span class="ruby-identifier">new</span>(
        <span class="ruby-identifier">group_id</span>,
        <span class="ruby-identifier">facet</span>.<span class="ruby-identifier">group_name</span>
      )
      <span class="ruby-ivar">@groups</span>[<span class="ruby-identifier">group_id</span>] = <span class="ruby-identifier">group</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">group</span>.<span class="ruby-identifier">add_facet</span>(<span class="ruby-identifier">facet</span>)
    <span class="ruby-identifier">facets</span>[<span class="ruby-identifier">facet</span>.<span class="ruby-identifier">unique_key</span>] = <span class="ruby-identifier">facet</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-gen_lazy_groups" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">gen_lazy_groups</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method is used for generating facet groups for this set</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Hash containing pairs of group_id =&gt; instance of <a
href="FacetGroup.html">AboutYou::SDK::Model::FacetGroup</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="gen_lazy_groups-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 56</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">gen_lazy_groups</span>
  <span class="ruby-identifier">groups</span> = {}
  <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">group_id</span>, <span class="ruby-identifier">facet_ids</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">group</span> = <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">FacetGroup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">group_id</span>, <span class="ruby-keyword">nil</span>)
    <span class="ruby-identifier">facet_ids</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">facet_id</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">facet</span> = <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">Facet</span>.<span class="ruby-identifier">new</span>(
        <span class="ruby-identifier">facet_id</span>,
        <span class="ruby-keyword">nil</span>,
        <span class="ruby-keyword">nil</span>,
        <span class="ruby-identifier">group_id</span>,
        <span class="ruby-keyword">nil</span>
      )
      <span class="ruby-identifier">group</span>.<span class="ruby-identifier">add_facet</span>(<span class="ruby-identifier">facet</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">groups</span>[<span class="ruby-identifier">group_id</span>] = <span class="ruby-identifier">group</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">groups</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-group" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">group</span><span
            class="method-args">(group_id)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>this method is used for getting a group of this set by a group id</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p><code>group_id</code> -&gt; the group id for which the facet group should
be returned</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Either nil if not found or instance of <a
href="FacetGroup.html">AboutYou::SDK::Model::FacetGroup</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="group-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 134</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">group</span>(<span class="ruby-identifier">group_id</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">groups</span>[<span class="ruby-identifier">group_id</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">groups</span>[<span class="ruby-identifier">group_id</span>]
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-group-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">group?</span><span
            class="method-args">(group_id)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>this method is used for checking whether a group is in this set or not</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p><code>group_id</code> -&gt; the group id used for searching</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Boolean determining whether this set includes the group_id or not</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="group-3F-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 147</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">group?</span>(<span class="ruby-identifier">group_id</span>)
  <span class="ruby-operator">!</span><span class="ruby-identifier">ids</span>[<span class="ruby-identifier">group_id</span>].<span class="ruby-identifier">empty?</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-group_ids" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">group_ids</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>getter for the facet group ids</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Array of facet group ids</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="group_ids-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 286</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">group_ids</span>
  <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">keys</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-lazy_groups" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">lazy_groups</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Getter for the facet groups of this set</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Hash containing pairs of group_id =&gt; instance of <a
href="FacetGroup.html">AboutYou::SDK::Model::FacetGroup</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="lazy_groups-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 82</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">lazy_groups</span>
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@groups</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@groups</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">gen_lazy_groups</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-unique_key" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">unique_key</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method is used for creating a unique key for this facet group set</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>a String containing a unique key for this facet group set</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="unique_key-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group_set.rb, line 188</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">unique_key</span>
  <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">sort!</span>
  <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">sub_ids</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sub_ids</span>.<span class="ruby-identifier">sort!</span> }

  <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">to_json</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
  </section>
</main>


<footer id="validator-badges" role="contentinfo">
  <p><a href="http://validator.w3.org/check/referer">Validate</a>
  <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.2.
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>

